package lab82;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

/**
 * 
 * AllCityMapper.java 用来处理所有城市的Mapper类
 * 处理所有城市的Mapper，处理完Mapper的输出结果为key-value健值对，其中key是城市的名字，value是 a_城市名，格式如下：
 * <济南，a_济南> <青岛，a_青岛> <德州，a_德州> .....
 */

public class AllCityMapper extends Mapper<LongWritable, Text, Text, Text> {

    public static final String LABEL = "a_";

    public void map(LongWritable key, Text value,
            org.apache.hadoop.mapreduce.Mapper<LongWritable, Text, Text, Text>.Context context)
            throws java.io.IOException, InterruptedException {
        // 获取城市的名字
        String cityName = value.toString();
        context.write(new Text(cityName), new Text(LABEL + cityName));
    }
}